package LeetcodeTest_thirty_nine;
//11.盛最多水的容器

public class maxArea
{
    public static void main(String[] args)
    {
        int[] height={1,8,6,2,5,4,8,3,7};
        System.out.println(Solutions.maxArea(height));
    }
}
class Solutions
{
    public static int maxArea(int[] height)
    {
        int n=height.length;
        int area=Integer.MIN_VALUE;
        for(int i=0;i<n-1;i++)
        {
            if(i>0 && height[i]<height[i-1])
                continue;
            for (int j = i + 1; j < n; j++)
            {
                int minHeight=Math.min(height[i],height[j]);
                area=Math.max(area,minHeight*(j-i));
            }
        }
        return area;
    }
}